home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93c.txt
/
000071_icon-group-sender _Wed Oct 6 13:59:52 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1994-02-02
|
2KB
Received: by cheltenham.cs.arizona.edu; Sun, 10 Oct 1993 10:18:00 MST
Date: 6 Oct 93 13:59:52 GMT
From: math.fu-berlin.de!news.belwue.de!iptc!news.wsi!peanuts!sperber@uunet.uu.net (Michael Sperber [Mr. Preprocessor])
Organization: Lehrstuhl fuer Technische Inforrmatik, Uni Tuebingen
Subject: Controlling programs via pty from Icon
Message-Id: <SPERBER.93Oct6145953@midi.informatik.uni-tuebingen.de>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
I recently had to write a program which had to control an interactive
ML interpreter through a pipe or something equivalent. Since Icon is
just fantastic for analyzing the output from the ML system, it was a
natural choice.
It turned out that Icon pipes were inadequate for the simple reason
that they can only either read or write. Even a simple C program that
opens a two-way pipe and writes the output into a file won't cut it.
So I had to mess with ptys and finally came up with a program (the
"flusher") that starts a job on a pty and flushes its output after
every line. That means I can do something like:
f_ml := open(flusher || " " || compiler || " > " ||
fn_ml_msgs || " 2>&1", "pw") |
And be sure the output gets into the redirected file when as soon as a
newline is printed. It's a KLUDGE, to be sure.
Now, if anyone is interested, I can mail it. I've written it under
AIX, but using only code gleaned from Sun and Linux manuals, so it
might actually work on other machines.
The more fundamental question: Wouldn't ptys disguised as two-way
pipes make a neat addition to the open function in Icon?
Cheers =8-} Chipsy